package org.ssm.learn;

import java.io.IOException;
import java.io.PipedOutputStream;

public class WriteData {
    public void writeMethod(PipedOutputStream outputStream) {
        try {
            System.out.println("write:");
            for (int i = 0; i < 300; i++) {
                String str = ""+(i+1);
                outputStream.write(str.getBytes());
                System.out.println("write:"+str);
            }
            System.out.println();
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
